<template>
  <div class="top">
    <el-image :src="bg" lazy fit="cover" />
    <div class="content">
      <h1 class="title">{{ title }}</h1>
      <div class="msg">{{ msg }}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'TopView',
  props: {
    name: {
      type: String,
      default: ''
    },
    title: {
      type: String,
      default: ''
    },
    msg: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      bg: ''
    }
  },
  created() {
    if (this.name === 'home') {
      this.bg = require('../assets/home.jpg')
    } else if (this.name === 'type') {
      this.bg = require('../assets/type.jpg')
    } else if (this.name === 'record') {
      this.bg = require('../assets/record.jpg')
    } else if (this.name === 'music') {
      this.bg = require('../assets/music.jpg')
    } else if (this.name === 'message') {
      this.bg = require('../assets/message.jpg')
    } else if (this.name === 'friend') {
      this.bg = require('../assets/friend.jpg')
    } else if (this.name === 'picture') {
      this.bg = require('../assets/picture.jpg')
    } else if (this.name === 'resource') {
      this.bg = require('../assets/resource.jpg')
    } else if (this.name === 'about') {
      this.bg = require('../assets/about.jpg')
    } else {
      this.bg = require('../assets/detail.jpg')
    }
  }
}
</script>
<style lang="less" scoped>
.top {
  width: 100%;
  height: 450px;
  position: relative;
  overflow: hidden;

  .el-image {
    width: 100%;
    height: 100%;
    position: relative;
    vertical-align: middle;
    max-width: 100%;
  }

  .content {
    width: 100%;
    height: 450px;
    background-color: rgba(0, 0, 0, 0.6);
    padding-top: 140px;
    box-sizing: border-box;
    position: absolute;
    left: 0px;
    bottom: 0px;
    color: #fff;
    font-family: 'STXingkai';
    letter-spacing: 2px;

    .title {
      width: 60%;
      height: 100px;
      font-size: 50px;
      margin: 0 auto;
    }

    .msg {
      font-size: 24px;
      width: 60%;
      height: 40px;
      line-height: 40px;
      margin: 0 auto;
      margin-top: 30px;
    }
  }
}
</style>
